package HuaWei;


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class HuaWei02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt).mapToInt(Integer::intValue).toArray();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            int num = arr[i] + 1;
            map.put(num, map.getOrDefault(num, 0) + 1);
        }

        int result = 0;
        for (Integer key : map.keySet()) {
            Integer value = map.get(key);
            for (int i = 0; i < value / key; i++) {
                result += key;
            }
            if (value % key != 0) {
                result += key;
            }
        }
        System.out.println(result);
    }
}
